package com.ricky;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Arrays;
import java.util.List;
import java.util.Random;

/**
 * Created by baiguantao on 2017/10/25.
 */
@SpringBootApplication
@EnableEurekaClient
@RestController
public class Eurekaclient2Application {
    private static Logger log = LoggerFactory.getLogger(Eurekaclient2Application.class);
    @RequestMapping(value = "/greeting")
    public String greet() {
        log.info("client2:Access /greeting");

        List<String> greetings = Arrays.asList("Hi there", "Greetings", "Salutations");
        Random rand = new Random();

        int randomNum = rand.nextInt(greetings.size());
        return greetings.get(randomNum);
    }
    public static void main(String[] args) {
        SpringApplication.run(Eurekaclient2Application.class, args);
    }
}
